package view;

import javax.swing.JPanel;
import javax.swing.JFrame;
import java.awt.Dimension;
import javax.swing.JLabel;
import java.awt.Rectangle;
import javax.swing.ImageIcon;
import java.awt.Point;
import java.awt.Font;
import java.awt.Color;
import javax.swing.BorderFactory;
import java.awt.Toolkit;
import javax.swing.JButton;
import javax.swing.SwingConstants;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;

public class addUserRole extends JFrame {

	private static final long serialVersionUID = 1L;
	private JPanel jContentPane = null;
	private JLabel icon = null;
	private JPanel jPanel = null;
	private JLabel lbuserRole = null;
	private JButton btnCancel = null;
	private JButton btnOK = null;
	private JLabel lbroleName = null;
	private JTextField txtrolename = null;
	private JPanel panelRole = null;

	public addUserRole() {
		super();
		initialize();
	}

	private void initialize() {
		this.setSize(450, 313);
		this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/image/management.png")));
		this.setName("addUserRole");
		this.setResizable(false);
		this.setContentPane(getJContentPane());
		this.setTitle("Add User Role");
	}

	private JPanel getJContentPane() {
		if (jContentPane == null) {
			lbroleName = new JLabel();
			lbroleName.setBounds(new Rectangle(120, 76, 90, 27));
			lbroleName.setText("Role Name:");
			icon = new JLabel();
			icon.setText("");
			icon.setLocation(new Point(26, 18));
			icon.setSize(new Dimension(85, 77));
			icon.setIcon(new ImageIcon(getClass().getResource("/image/userg.png")));
			jContentPane = new JPanel();
			jContentPane.setLayout(null);
			jContentPane.add(icon, null);
			jContentPane.add(getJPanel(), null);
			jContentPane.add(getBtnCancel(), null);
			jContentPane.add(getBtnOK(), null);
			jContentPane.add(lbroleName, null);
			jContentPane.add(getTxtrolename(), null);
			jContentPane.add(getPanelRole(), null);
		}
		return jContentPane;
	}

	private JPanel getJPanel() {
		if (jPanel == null) {
			lbuserRole = new JLabel();
			lbuserRole.setForeground(new Color(8, 66, 36));
			lbuserRole.setText("Add User Role");
			lbuserRole.setSize(new Dimension(127, 28));
			lbuserRole.setLocation(new Point(0, 8));
			lbuserRole.setFont(new Font("Dialog", Font.BOLD, 18));
			jPanel = new JPanel();
			jPanel.setLayout(null);
			jPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, Color.red));
			jPanel.setLocation(new Point(133, 16));
			jPanel.setSize(new Dimension(128, 36));
			jPanel.add(lbuserRole, null);
		}
		return jPanel;
	}

	private JButton getBtnCancel() {
		if (btnCancel == null) {
			btnCancel = new JButton();
			btnCancel.setHorizontalTextPosition(SwingConstants.RIGHT);
			btnCancel.setIcon(new ImageIcon(getClass().getResource("/image/Close.png")));
			btnCancel.setText("cancel");
			btnCancel.setLocation(new Point(322, 232));
			btnCancel.setSize(new Dimension(100, 36));
			btnCancel.setHorizontalAlignment(SwingConstants.LEFT);
		}
		return btnCancel;
	}

	private JButton getBtnOK() {
		if (btnOK == null) {
			btnOK = new JButton();
			btnOK.setHorizontalTextPosition(SwingConstants.RIGHT);
			btnOK.setIcon(new ImageIcon(getClass().getResource("/image/OK.png")));
			btnOK.setText("OK");
			btnOK.setLocation(new Point(194, 231));
			btnOK.setSize(new Dimension(91, 36));
			btnOK.setHorizontalAlignment(SwingConstants.LEFT);
		}
		return btnOK;
	}

	private JTextField getTxtrolename() {
		if (txtrolename == null) {
			txtrolename = new JTextField();
			txtrolename.setLocation(new Point(226, 75));
			txtrolename.setSize(new Dimension(159, 28));
		}
		return txtrolename;
	}

	private JPanel getPanelRole() {
		if (panelRole == null) {
			panelRole = new JPanel();
			panelRole.setLayout(null);
			panelRole.setBounds(new Rectangle(45, 108, 364, 118));
			panelRole.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(new Color(102, 102, 255), 2), "Permission", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(0, 0, 204)));
		}
		return panelRole;
	}

}
